using Microsoft.VisualBasic.CompilerServices;
using SJXmlP.XMLClasses;
using System;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using yWriter6.My.Resources;

namespace yWriter6
{
	[DesignerGenerated]
	public class frmPickTags : Form
	{
		private IContainer components;

		[CompilerGenerated]
		[AccessedThroughProperty("ListTags")]
		private ListBox _ListTags;

		[CompilerGenerated]
		[AccessedThroughProperty("txtOK")]
		private Button _txtOK;

		[CompilerGenerated]
		[AccessedThroughProperty("txtCancel")]
		private Button _txtCancel;

		[CompilerGenerated]
		[AccessedThroughProperty("ToolTip1")]
		private ToolTip _ToolTip1;

		public bool Cancelled;

		public clsCollection<string> colPickedTags;

		[field: AccessedThroughProperty("ListTags")]
		internal virtual ListBox ListTags
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		internal virtual Button txtOK
		{
			[CompilerGenerated]
			get
			{
				return _txtOK;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = txtOK_Click;
				Button txtOK = _txtOK;
				if (txtOK != null)
				{
					txtOK.Click -= value2;
				}
				_txtOK = value;
				txtOK = _txtOK;
				if (txtOK != null)
				{
					txtOK.Click += value2;
				}
			}
		}

		internal virtual Button txtCancel
		{
			[CompilerGenerated]
			get
			{
				return _txtCancel;
			}
			[MethodImpl(MethodImplOptions.Synchronized)]
			[CompilerGenerated]
			set
			{
				EventHandler value2 = txtCancel_Click;
				Button txtCancel = _txtCancel;
				if (txtCancel != null)
				{
					txtCancel.Click -= value2;
				}
				_txtCancel = value;
				txtCancel = _txtCancel;
				if (txtCancel != null)
				{
					txtCancel.Click += value2;
				}
			}
		}

		[field: AccessedThroughProperty("ToolTip1")]
		internal virtual ToolTip ToolTip1
		{
			get;
			[MethodImpl(MethodImplOptions.Synchronized)]
			set;
		}

		[DebuggerNonUserCode]
		protected override void Dispose(bool disposing)
		{
			try
			{
				if (disposing && components != null)
				{
					components.Dispose();
				}
			}
			finally
			{
				base.Dispose(disposing);
			}
		}

		[System.Diagnostics.DebuggerStepThrough]
		private void InitializeComponent()
		{
			components = new System.ComponentModel.Container();
			ListTags = new System.Windows.Forms.ListBox();
			txtOK = new System.Windows.Forms.Button();
			txtCancel = new System.Windows.Forms.Button();
			ToolTip1 = new System.Windows.Forms.ToolTip(components);
			SuspendLayout();
			ListTags.FormattingEnabled = true;
			ListTags.ItemHeight = 17;
			ListTags.Location = new System.Drawing.Point(10, 13);
			ListTags.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			ListTags.Name = "ListTags";
			ListTags.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
			ListTags.Size = new System.Drawing.Size(235, 310);
			ListTags.Sorted = true;
			ListTags.TabIndex = 0;
			ToolTip1.SetToolTip(ListTags, "Ctrl+Click to select multiple items");
			txtOK.AutoSize = true;
			txtOK.DialogResult = System.Windows.Forms.DialogResult.OK;
			txtOK.Location = new System.Drawing.Point(180, 330);
			txtOK.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			txtOK.Name = "txtOK";
			txtOK.Size = new System.Drawing.Size(65, 42);
			txtOK.TabIndex = 1;
			txtOK.Text = "Ok";
			txtOK.UseVisualStyleBackColor = true;
			txtCancel.AutoSize = true;
			txtCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			txtCancel.Location = new System.Drawing.Point(10, 330);
			txtCancel.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			txtCancel.Name = "txtCancel";
			txtCancel.Size = new System.Drawing.Size(65, 42);
			txtCancel.TabIndex = 1;
			txtCancel.Text = "Cancel";
			txtCancel.UseVisualStyleBackColor = true;
			base.AcceptButton = txtOK;
			base.AutoScaleDimensions = new System.Drawing.SizeF(7f, 17f);
			base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			base.CancelButton = txtCancel;
			base.ClientSize = new System.Drawing.Size(255, 382);
			base.Controls.Add(txtCancel);
			base.Controls.Add(txtOK);
			base.Controls.Add(ListTags);
			DoubleBuffered = true;
			Font = new System.Drawing.Font("Segoe UI", 10f);
			base.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			base.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
			base.MaximizeBox = false;
			base.Name = "frmPickTags";
			base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			Text = "Pick Tags";
			ResumeLayout(false);
			PerformLayout();
		}

		private void frmPickTags_Load(object sender, EventArgs e)
		{
			base.Icon = Resources.yWriter5_Ico;
		}

		public frmPickTags(clsCollection<string> colTags)
		{
			base.Load += frmPickTags_Load;
			colPickedTags = new clsCollection<string>();
			InitializeComponent();
			FillTags(colTags);
		}

		public void FillTags(clsCollection<string> colTags)
		{
			ListTags.Items.Clear();
			IEnumerator enumerator = default(IEnumerator);
			try
			{
				enumerator = colTags.GetEnumerator();
				while (enumerator.MoveNext())
				{
					string text = Conversions.ToString(enumerator.Current);
					if (Operators.CompareString(text.Trim(), "", TextCompare: false) != 0)
					{
						ListTags.Items.Add(text);
					}
				}
			}
			finally
			{
				if (enumerator is IDisposable)
				{
					(enumerator as IDisposable).Dispose();
				}
			}
		}

		private void txtCancel_Click(object sender, EventArgs e)
		{
			Hide();
		}

		private void txtOK_Click(object sender, EventArgs e)
		{
			IEnumerator enumerator = default(IEnumerator);
			try
			{
				enumerator = ListTags.SelectedItems.GetEnumerator();
				while (enumerator.MoveNext())
				{
					string text = Conversions.ToString(enumerator.Current);
					if (Operators.CompareString(text.Trim(), "", TextCompare: false) != 0)
					{
						colPickedTags.Add(text, text);
					}
				}
			}
			finally
			{
				if (enumerator is IDisposable)
				{
					(enumerator as IDisposable).Dispose();
				}
			}
			Hide();
		}
	}
}
